<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    var str = "aabb";
    var reg = /([a-z])\1/g;
    var c = str.replace(reg,"cc");
    var c = str.replace(reg,"bb");
    var c = c.replace(reg,"aa");
    console.log(c);

</script>
</html>